function graphAnalysisMC(inDir,outDir)


%inDir='C:\Users\matthew\Desktop\Projects\Batch\analysis\mc\';
%outDir='C:\Users\matthew\Desktop\Projects\Batch\analysis\mc\';

th=0.01;
iter=1;
times=50;

bandNames={'theta','alpha','beta','gamma'};

for i=1:length(bandNames)

     filter=fullfile(inDir,'pli_');
     filter=strcat(filter,bandNames{i});
     filter=strcat(filter,'_sp*');

     subjs=dir(filter);
     nSubjs=length(subjs);

     graph.one=zeros(nSubjs,4);
     graph.two=zeros(nSubjs,4);

     for j=1:nSubjs
         subjName=subjs(j).name;

         load(fullfile(inDir,subjName),'pliXT');

         sp=pliXT;

         [subjName,name]=strtok(subjName,'-');
         subjName=subjName(1:end-2);
         subjName=strcat(subjName,'comp');
         subjName=strcat(subjName,name);

         load(fullfile(inDir,subjName),'pliXT');

         comp=pliXT;

        [graph.one(j,1),graph.one(j,2),graph.one(j,3),graph.one(j,4)]=calculateCandL(squeeze(mean(sp,1)),th,iter,times);
        [graph.two(j,1),graph.two(j,2),graph.two(j,3),graph.two(j,4)]=calculateCandL(squeeze(mean(comp,1)),th,iter,times);

     end
     
     outfile=strcat('graph_',bandNames{i});
     save(fullfile(outDir,outfile),'graph');
end
